
#ifndef IRIDE_MATRIX4_H_
#define IRIDE_MATRIX4_H_

#include <string>
#include "Types.h"
#include "Vector3.h"
#include "Vector4.h"

namespace Iride
{
	class Matrix4
	{

	protected:
		union
		{
		   Real   m [4][4];
		   Real  _m [16];
		};

	public:
		Matrix4();
		Matrix4(Real m00, Real m01, Real m02, Real m03,
				Real m10, Real m11, Real m12, Real m13,
				Real m20, Real m21, Real m22, Real m23,
				Real m30, Real m31, Real m32, Real m33);

		Real* operator[] (const size_t row);
		const Real *operator[] (const size_t row ) const;

		Matrix4 operator - ( void ) const;

		Matrix4 operator + (const Matrix4&) const;
		Matrix4 operator - (const Matrix4&) const;
		Matrix4 operator * (const Matrix4&) const;

		Matrix4 operator * (const Real&) const;
		Matrix4 operator / (const Real&) const;

		Vector4 operator * (const Vector4&) const;

		Vector3 operator * (const Vector3&) const;	// Vector3 is treated as a point, ie. w = 1

		Matrix4& operator+= (const Matrix4&);
		Matrix4& operator-= (const Matrix4&);

		Matrix4 transpose(void) const;

		void MakeRotateX(Real angle);
		void MakeRotateY(Real angle);
		void MakeRotateZ(Real angle);

		void MakeTranslate(const Vector4 &trans);

		static const Matrix4 ZERO;
		static const Matrix4 IDENTITY;

		std::string ToString() const;

	};
};

#endif


